<?php
    // +----------------------------------------------------------------------
    // | 短信模型
    // +----------------------------------------------------------------------
    // | Copyright (c) 2015-2024 http://www.yicmf.com, All rights reserved.
    // +----------------------------------------------------------------------
    // | Author: 微尘 <yicmf@qq.com>
    // +----------------------------------------------------------------------
    namespace app\model\ucenter;

    class Sms extends Common
    {
        public function user()
        {
            return $this->belongsTo(User::class);
        }

        // 类型转换
        protected $type = [
            'data' => 'array'
        ];

		/**
		 * 写入修改
		 * @param $data
		 */
		public static function onBeforeInsert($data)
		{
			$data['ip'] = request()->ip();
			$data['token'] = md5(time() . rand(110000,9999999));
		}


    }
